<h2>Panel d'administration</h2>
<p><a href="<?php echo site_url('admin/insertarticle'); ?>" class="btn btn-primary">Ajouter un article</a></p>
<?php if ($articles): ?>
    <table>
        <tr>
            <td>Titre</td>
            <td>Prix</td>
            <td>Voir</td>
            <td>Edit</td>
            <td>Delete</td>
        </tr>
        <?php
        foreach ($articles as $a):
            // On appelle l'url, au passage on passe par le controller article, méthode show
            $show = site_url('article/show/' . $a->article_id);
            $edit = site_url('admin/editarticle/' . $a->article_id);
            $delete = site_url('admin/deletearticle/' . $a->article_id);
            ?>
            <tr>
                <td><?php echo $a->title; ?></h3></td>
                <td><a href="#" class="btn btn-warning"><?php echo number_format($a->price_amount, 2, ',', ' ') ?>€</a> </td>
                <td><a href="<?php echo $show; ?>" class="btn btn-primary">Voir</a></td>
                <td><a href="<?php echo $edit; ?>" class="btn btn-primary">Edit</a></td>
                <td><a href="<?php echo $delete; ?>" class="btn btn-danger">X</a></td>
            </tr>
        <?php endforeach; ?>
    </table>
<?php endif; ?>